#!/usr/bin/env python

from models import UserProfile
from esapi.reference.random_access_reference_map import RandomAccessReferenceMap
    
all_users = []

all_users.append( UserProfile("user1", "My password is abc123. It's really secure, but it controls EVERYTHING, so don't tell anyone - please.") )

all_users.append( UserProfile("user2", "So long, and thanks for all the fish<br>So sad that it should come to this") )

all_users.append( UserProfile("user3", "Take the blue pill... trust me!") )

all_users.append( UserProfile("user4", "The Matrix has you.") )

all_users.append( UserProfile("user5", "Captain's log, stargate 94392...") )

all_users.append( UserProfile("user6", "Tron, is that you?") )

all_users.append( UserProfile("user7", "Oh man...when you're on the other side of the screen...it all looks so easy...") )

all_users.append( UserProfile("user8", "I should never have written all of those tank programs!") )

all_users.append( UserProfile("user9", "I'm the CEO of a large bank.") )

users_map = {}
arm = RandomAccessReferenceMap()
for user in all_users:
    users_map[user.username] = user
    arm.add_direct_reference(user)

def get_partial_username_key_list_secure():
    ret = []
    for user in all_users[:5]:
        ret.append( (user.username, arm.get_indirect_reference(user)) )
        
    return ret

def get_partial_username_key_list_insecure():
    ret = []
    for user in all_users[:5]:
        ret.append( (user.username, user.username) )
        
    return ret
